x <- c(1:10)
y <- x
z <- 10/x
opar <- par(no.readonly=TRUE)

# par(mar=c(5, 4, 4, 8) + 0.1)
plot(x, y, type="b", pch=21, col="red", yaxt="n", lty=3, ann=FALSE)

#添加一根线，以z为值
lines(x, z, type="b", pch=22, col="blue", lty=2)
#在左侧添加y轴坐标，刻度值为x
axis(2, at=x, labels=x, col.axis="red", labs=2)
#在右侧生成y轴坐标，刻度值为z
axis(4, at=z, labels=round(z, digits=2), col.axis="blue", labs=2, cex.axis=0.7, tck=-.01)
#添加边界文本, 右侧
mtext("y=1/x", side=4, line=3, cex.lab=1, labs=2, col="blue")
title("An Example of Creative Axes", xlab="X values", ylab="Y=X")
par(opar)
